package com.xquant.common.core.constant;

import java.util.Arrays;
import java.util.Locale;

/**
 * 功能说明：数据字典常量类
 * 编写作者：yubt
 * 开发日期：2021-11-2 14:24:00
 * 修改记录：修改日期   修改人    修改内容
 */
public class DictConstant {

    /**
     * 产品类型
     */
    public static interface PRODUCT_TYPE {
        /**
         * 场外期权
         */
        public static final String OTC_OPTION = "OtcOption";
        /**
         * 外汇期权
         */
        public static final String FX_OTC_OPTION = "FxOtcOption";
        /**
         * 信用违约互换
         */
        public static final String CDS = "CDS";
        /**
         * 信用风险缓释凭证
         */
        public static final String CRMW = "CRMW";
        /**
         * 远期合约
         */
        public static final String FORWARD = "Forward";
        /**
         * 利率期权
         */
        public static final String IR_OPTION = "IrOption";
        /**
         * 利率互换
         */
        public static final String IR_SWAP = "IrSwap";
        /**
         * 收益凭证
         */
        public static final String INCOME_CERTIFICATE = "IncomeCertificate";
        /**
         * 国债期货
         */
        public static final String BOND_FUTURE = "BondFuture";
        /**
         * 债券
         */
        public static final String BOND = "Bond";
        /**
         * 商品掉期
         */
        public static final String CMDT_SWAP = "CommoditySwap";
        /**
         * 商品远期
         */
        public static final String CMDT_FORWARD = "CommodityForward";
        /**
         * 现金借贷
         */
        public static final String IRSTREAMS = "IRStreams";
        /**
         * 组合期权
         */
        public static final String STRATEGY = "STRATEGY";
    }

    /**
     * 交易方向
     */
    public static interface DIRECT {
        /**
         * 买入
         */
        public static final String BUY = "1";

        /**
         * 卖出
         */
        public static final String SELL = "-1";
    }

    /**
     * xIR交易方向
     */
    public static interface IR_DIRECT {
        /**
         * 买入
         */
        public static final String BUY = "1010";

        /**
         * 卖出
         */
        public static final String SELL = "1011";
    }

    /**
     * 看涨看跌
     */
    public static interface CallOrPut {
        /**
         * 看涨
         */
        public static final String Call = "Call";

        /**
         * 看跌
         */
        public static final String Put = "Put";
    }

    /*
     * 交易日调整
     * */
    public static interface BusinessDayConvention {
        public static final String Following = "Following";//调整到下个交易日
        public static final String ModifiedFollowing = "ModifiedFollowing";//调整到下个交易日，若遇到月末，调整到上个交易日
        public static final String Preceding = "Preceding";//向前调整到前一个交易日
        public static final String ModifiedPreceding = "ModifiedPreceding";//向前调整到前一个交易日，若遇到月末，调整到上个交易日
        public static final String Unadjusted = "Unadjusted";//不调整
        public static final String NONE = "";//不调整
    }

    /**
     * 期权类型
     */
    public enum OPTION_TYPE {
        SPREAD("SPREAD", "价差期权"),
        ELN_ACB_BASICSNOWBALL("ELN_ACB_BASICSNOWBALL", "保本返息雪球期权"),
        MULTI_STOREY_DIGITAL("MULTI_STOREY_DIGITAL", "多层二元期权"),
        MULTILAYERDIGITAL("MultilayerDigital", "多层二元期权(新版)"),
        MULTI_DIGITAL("MultiDigital", "三层阶梯期权"),
        TOUCH("Touch", "Touch期权"),
        ONE_TOUCH("OneTouch", "OneTouch期权"),
        ELN_ACB_STANDARDSNOWBALL("ELN_ACB_STANDARDSNOWBALL", "非保本返息雪球期权"),
        DISPERTOUCH("DisperTouch", "离散Touch期权"),
        COLLAR("COLLAR", "领子期权"),
        SHARK("SingleSharkFin", "鲨鱼鳍期权"),
        ELN_ACB_VANILLASPREAD("ELN_ACB_VANILLASPREAD", "保本价差雪球期权"),
        DIGITAL("Digital", "二元期权(数字期权)"),
        VANILLA("Vanilla", "香草期权(普通期权)"),
        Barrier("Barrier", "障碍期权"),
        KnockOut("KnockOut", "敲出障碍期权"),
        KnockIn("KnockIn", "敲入障碍期权"),
        DOUBLE_DIGITAL("DoubleDigital", "双层二元期权"),
        DOUBLE_SHARK("DoubleShark", "双鲨期权"),
        DOUBLE_BARRIER("DoubleBarrier", "双障碍期权"),
        DOUBLENOTOUCH("DoubleNoTouch", "双重触碰"),
        AIRBAG("Airbag", "气垫期权"),
        RANGEACCRUAL("RangeAccrual", "区间累计期权"),

        UNKNOWN("UNKNOWN", "不支持");

        private String code;
        private String desc;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        OPTION_TYPE(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static OPTION_TYPE getEnumType(String code) {
            return Arrays.asList(OPTION_TYPE.values()).stream()
                    .filter(otcTypeEnum -> otcTypeEnum.getCode().toLowerCase(Locale.ROOT).equals(code.toLowerCase(Locale.ROOT)))
                    .findFirst().orElse(OPTION_TYPE.UNKNOWN);
        }
    }

    /**
     * 计算请求类型
     */
    public static interface CAL_TYPE {

        /**
         * 市场计算
         */
        public static final String CALC_MARKET = "calcMarket";

        /**
         * 情景计算
         */
        public static final String CALC_SCENE = "calcScene";

        /**
         * 现金流计算
         */
        public static final String CALC_PAYMENTINFO = "calcPaymentInfo";

        /**
         * 定盘日序列
         */
        public static final String READ_FIXINGDATES = "readFixingDates";

        /**
         * 计息明细计算
         */
        public static final String CALC_ACCRUALDETAIL = "calcAccrualDetail";

        /**
         * 到期现金流计算
         */
        public static final String CALC_MATURITY_PAYMENT = "calcMaturityPayment";

        /**
         * 试算
         */
        public static final String CALC_TRIAL = "calcTrial";

        /**
         * 实物明细计算
         */
        public static final String CALC_ASSETDETAIL = "calcAssetDetail";

    }

    /**
     * 交易所代码
     */
    public static interface EXCHANGE_CODE {

        /**
         * 深圳证券交易所
         */
        public static final String SZ = "SZ";

        /**
         * 上海证券交易所
         */
        public static final String SH = "SH";

        /**
         * 上海国际能源交易中心
         */
        public static final String INE = "INE";

        /**
         * 上海黄金交易所
         */
        public static final String SGE = "SGE";

        /**
         * 上海期货交易所
         */
        public static final String SHF = "SHF";

        /**
         * 郑州商品交易所
         */
        public static final String CZC = "CZC";

        /**
         * 大连商品交易所
         */
        public static final String DCE = "DCE";

    }

    /**
     * 内部交易所代码
     */
    public static interface EXCHANGE_INNER_CODE {

        /**
         * 深圳证券交易所
         */
        public static final String SZ = "XSHE";

        /**
         * 上海证券交易所
         */
        public static final String SH = "XSHG";

        /**
         * 上海国际能源交易中心
         */
        public static final String INE = "XINE";

        /**
         * 上海黄金交易所
         */
        public static final String SGE = "SGEX";

        /**
         * 上海期货交易所
         */
        public static final String SHF = "XSGE";

        /**
         * 郑州商品交易所
         */
        public static final String CZC = "XZCE";

        /**
         * 大连商品交易所
         */
        public static final String DCE = "XDCE";

    }

    /**
     * 看涨看跌
     */
    public static interface OPTION_DIRECT {

        /**
         * 看涨
         */
        public static final String CALL = "Call";
        /**
         * 看跌
         */
        public static final String PUT = "Put";
    }

    /**
     * 是否
     */
    public static interface YES_NO {
        /**
         * 是
         */
        public static final String YES = "1";
        /**
         * 否
         */
        public static final String NO = "0";
    }

    /**
     * IR支付时机
     */
    public static interface IR_PAY_STYLE {
        /**
         * 触发支付
         */
        public static final String TRRIGER_PAY = "PayOnHit";
        /**
         * 期末支付
         */
        public static final String EXPIR_PAY = "PayOnExpire";
    }

    /**
     * 是否
     */
    public static interface PAY_STYLE {
        /**
         * 触发支付
         */
        public static final String TRRIGER_PAY = "Immediate";
        /**
         * 期末支付
         */
        public static final String EXPIR_PAY = "Deferred";
    }

    /**
     * 观察类型 0：连续观察，1：每日观察，默认0
     */
    public static interface SCHEDULE_TYPE {
        /**
         * 连续观察
         */
        public static final String CONT_OBS = "0";
        /**
         * 每日观察
         */
        public static final String EVERY_DAY = "1";
    }

    /**
     * 障碍方向
     */
    public static interface KNOCK_TYPE {
        /**
         * 向下敲入
         */
        public static final String DOWN_AND_IN = "KnockIn";
        /**
         * 向下敲出
         */
        public static final String DOWN_AND_OUT = "KnockOut";
        /**
         * 向上敲入
         */
        public static final String UP_AND_IN = "KnockIn";
        /**
         * 向上敲出
         */
        public static final String UP_AND_OUT = "KnockOut";

        /**
         * 双重敲入
         */
        public static final String DOUBLE_KNOCK_IN = "DoubleKnockIn";
        /**
         * 双重敲出
         */
        public static final String DOUBLE_KNOCK_OUT = "DoubleKnockOut";
    }

    /**
     * 观察类型 E:欧式鲨鱼鳍 A：美式鲨鱼鳍
     */
    public static interface OBSERVE_TYPE {
        /**
         * 欧式
         */
        public static final String EUROPEAN = "E";
        /**
         * 美式
         */
        public static final String AMERICAN = "A";
    }

    /**
     * 行权类型 E:欧式鲨鱼鳍 A：美式鲨鱼鳍
     */
    public static interface EXERCISE_TYPE {
        /**
         * 欧式
         */
        public static final String EUROPEAN = "European";
        /**
         * 美式
         */
        public static final String AMERICAN = "American";
    }

    /**
     * 是否包含
     */
    public static interface INCLUDE_TYPE {
        /**
         * 小于
         */
        public static final String LESS = "Less";
        /**
         * 小于等于
         */
        public static final String EQUALORLESS = "EqualOrLess";
        /**
         * 大于
         */
        public static final String GREATER = "Greater";
        /**
         * 大于等于
         */
        public static final String EQUALORGREATER = "EqualOrGreater";
    }


    /**
     * summit导入来源
     */
    public static interface IMP_SOURCE {
        /**
         *  summit接口 option类型
         */
        public static final String OPTIONS = "OPTIONS";
        /**
         * summit接口 must类型
         */
        public static final String MUST = "MUST";

    }
}



